package serializable;

import java.io.Serializable;

/*本类用与测试序列化的物料类*/
/*如果一个类的对象想要被序列化输出，那么这个类必须实现可序列化接口，否则会报错
* Serializable接口是一个空接口，里面没有方法
* 作用是当做标志，标志这个类可以被序列化*/
public class Student implements Serializable {
    //1.1创建学生类的属性
    private  String name ;//姓名
    private int age ;//年龄
    private String addr;//地址
    private char gender;//性别
    //1.2提供属性对应的get与set方法

    //2.1提供无参构造
    public Student() {
        System.out.println("我是无参构造");
    }
    //2.2提供全参构造
    public Student(String name, int age, String addr, char gender) {
        this.name = name;
        this.age = age;
        this.addr = addr;
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }
}
